<html>
<head>
<title> Setting Up Remote Database Hosting </title>
<meta name="Keywords" content="" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="stylesheet.css"/>
<script src="locate.js"></script>
<link href="prettify.css" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="prettify.js"></script>
</head>
<script src="highlight.js"></script>
<body bgcolor="#FFFFFF" text="#000000" link="#0000A0" alink="#008000" vlink="#FF0000" onLoad="FindCorrectTOCPage(); prettyPrint()">
<table cellpadding="0" cellspacing="0" border="0">
<tr valign="top">
<td>
<p class="pagenavigation"><a href="17185.htm" target="_self"><img src="38976.gif" alt="Previous page" height="16" width="16" vspace="0" hspace="1" align="top" border="0"> Previous page</a></p></td>
<td>
<p class="pagenavigation"><a href="17206.htm" target="_self"><img src="38977.gif" alt="Next page" height="16" width="16" vspace="0" hspace="1" align="top" border="0"> Next page</a></p></td>
<td>
<p class="pagenavigation"><a href="toc4151869.htm" target="TOC"><img src="38970.gif" alt="Locate page" height="16" width="16" vspace="0" hspace="1" align="top" border="0"> Locate page</a></p></td>
<td>
<p class="pagenavigation"><a href="toc4151869.htm" target="TOC"><a class="" title="" href="javascript:print();" target="_self"><img src="39072.gif" alt="Print this page" height="16" width="16" vspace="0" hspace="1" align="top" border="0"></a></a></p></td>
</tr>
</table>
<h3 class="heading3">Setting Up Remote Database Hosting</h3>
<p class="bodytext">If you are going to use a Plesk-managed server as a remote database server, you do not need to install MySQL software: Plesk comes with MySQL software, which is automatically installed during installation of Plesk. In this case, you only need to enable network access to this database server and then register it with Plesk.</p>
<p class="procedureheading">To set up a MySQL database server:</p>
<ol class="procedurelistnumber"><li class="procedurelistnumber">Copy to your server a MySQL distribution package from your operating system distribution disk, or download it from www.mysql.com site and save it on your server.</li><li class="procedurelistnumber">Log in as root to your server and change to the directory where you saved the RPM distribution. Type the following command at the prompt:<p class="listcontinue"><code class="monospace"><code class="monospace">rpm -ivh</code></code> <code class="monospace">mysql_file_name.rpm</code></p>
</li><li class="procedurelistnumber">Set the database server administrator's password. Type the following command at the prompt:<p class="listcontinue"><code class="monospace"><code class="monospace">mysqladmin -u root password your_desired_password</code></code></p>
<p class="listcontinue">Change your_desired_password to anything you like.</p>
</li><li class="procedurelistnumber">Now proceed to the instructions on registering your database server with Plesk.</li></ol><p class="bodytext"></p>
<p class="procedureheading">To set up a PostgreSQL database server:</p>
<ol class="procedurelistnumber"><li class="procedurelistnumber">Copy to your server a PostgreSQL distribution package from your operating system distribution disk, or download it from www.postgresql.org site and save it on your server.</li><li class="procedurelistnumber">Log in as root to the server where you want to host databases, and change to the directory where you saved the distribution package.</li><li class="procedurelistnumber">Install the package in a way suitable for your operating system.<ul class="listbullet2"><li class="listbullet2">For RPM based Linux systems, type the following command at the prompt:<p class="listcontinue2"><code class="monospace"><code class="monospace">rpm -ivh postgresql_file_name.rpm</code></code></p>
</li><li class="listbullet2">For deb package based Linux systems, issue the command:<p class="listcontinue2"><code class="monospace"><code class="monospace">apt-get install package_name</code></code></p>
</li><li class="listbullet2">For FreeBSD systems, to install from a package, issue the following command:<p class="listcontinue2"><code class="monospace"><code class="monospace">pkg_add pgsql-&lt;version&gt;.tgz</code></code></p>
</li><li class="listbullet2">To install from ports, issue the following commands:<p class="listcontinue2"><code class="monospace"><code class="monospace">cd /usr/ports/databases/postgresql&lt;version&gt;-server</code></code></p>
<p class="listcontinue2"><code class="monospace"><code class="monospace">make install package clean</code></code></p>
</li></ul></li><li class="procedurelistnumber">Open the file <code class="monospace">/var/lib/pgsql/data/postgresql.conf</code> with a text editor. If you are installing PostgreSQL version earlier than 8, add the line  <code class="monospace">tcpip_socket = true</code> to this file.  If you are installing PostgreSQL version later than 8, add the line <code class="monospace">listen_addresses = '*'</code>.</li><li class="procedurelistnumber">Open the file <code class="monospace">/var/lib/pgsql/data/pg_hba.conf</code> with a text editor and make sure the following lines are there:<p class="listcontinue"><code class="monospace"><code class="monospace"># local DATABASE USER METHOD [OPTION]</code></code></p>
<p class="listcontinue"><code class="monospace"><code class="monospace">local samegroup all password</code></code></p>
<p class="listcontinue"><code class="monospace"><code class="monospace"># host DATABASE USER IP-ADDRESS IP-MASK METHOD [OPTION]</code></code></p>
<p class="listcontinue"><code class="monospace"><code class="monospace">host samegroup all 0.0.0.0 0.0.0.0 md5</code></code></p>
</li><li class="procedurelistnumber">To restart PostgreSQL, issue the following command at the prompt:<p class="listcontinue"><code class="monospace"><code class="monospace">service postgresql restart</code></code></p>
</li><li class="procedurelistnumber">To set the database server administrator's password, issue the following commands at the prompt (change 'your_desired_password' to anything you like):<p class="listcontinue"><code class="monospace">psql -d template1 -U postgres</code></p>
<p class="listcontinue"><code class="monospace"><code class="monospace">alter user postgres with password 'your_desired_password';</code></code></p>
</li><li class="procedurelistnumber">Now proceed to the instructions on registering your database server with Plesk.</li></ol><p class="bodytext"></p>
<p class="procedureheading">To register a database server with Plesk:</p>
<ol class="procedurelistnumber"><li class="procedurelistnumber">Log in to Plesk.</li><li class="procedurelistnumber">Click the <strong class="specialbold">Server</strong> shortcut in the navigation pane.</li><li class="procedurelistnumber">Click the <strong class="specialbold">Database Servers</strong> icon in the <strong class="specialbold">Services</strong> group.</li><li class="procedurelistnumber">Click the <strong class="specialbold">Add Database Server</strong> icon in the <strong class="specialbold">Tools</strong> group.</li><li class="procedurelistnumber">Specify the properties of the database server:<ul class="listbullet2"><li class="listbullet2">Specify hostname or IP address of the database server.</li><li class="listbullet2">Specify the port number the database server is listening on. By default, MySQL servers listen on port 3306, and PostgreSQL on port 5342. You can leave the <strong class="specialbold">Port number</strong> box blank, if your database server is listening on the default port.</li><li class="listbullet2">Specify which database type is running on the database server.</li><li class="listbullet2">To make this database server default for hosting customers' databases, select the check box labeled <strong class="specialbold">Use this server as default for MySQL</strong>. If you have a PostgreSQL database server, select the check box labeled <strong class="specialbold">Use this server as default for PostgreSQL</strong>.</li><li class="listbullet2">Specify the database server administrator's login name and password.</li></ul></li><li class="procedurelistnumber">Click <strong class="specialbold">OK</strong>.</li></ol><p class="bodytext"></p>
<p class="procedureheading">To set up database hosting preferences that will affect all databases created through Plesk: </p>
<ol class="procedurelistnumber"><li class="procedurelistnumber">Go to <strong class="specialbold">Server</strong> &gt; <strong class="specialbold">Database Servers</strong> &gt; <strong class="specialbold">Preferences</strong>.</li><li class="procedurelistnumber">To simplify maintenance of customers' databases, select the <strong class="specialbold">Add client's login name and underscore to beginning of database names</strong> check box. All names of newly created databases will look like client's login name_database name. This will allow you to locate databases related to a particular Plesk user. Note that even if you do not select this check box, on creation of a new database, Plesk will add client's login name to the database name input box, and you will be able to edit it or remove it. </li><li class="procedurelistnumber">You can also set up Plesk to add client's login names to corresponding database user names, further simplifying the maintenance of customers' databases. To do so, select the <strong class="specialbold">Add client's login name and underscore to the beginning of database user names</strong> check box. All names of newly created database users will look like client's login name_database user name. This will allow you to locate database users related to a particular Plesk user.</li><li class="procedurelistnumber">Specify whether creation of databases is allowed on your Plesk server. Some applications do not support remote databases and can work only with databases hosted on the same server. We recommend leaving the default option <strong class="specialbold">Allow local hosting of databases for these site applications</strong> selected, otherwise, you will not be able to use such applications.</li><li class="procedurelistnumber">Click <strong class="specialbold">OK</strong>.</li></ol>


</body>
<script>highlightTOC()</script>
</html>

